package com.financing.platform.dao.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.financing.platform.dao.IWxUserInfoDao;
import com.financing.platform.dto.WxUserInfoDTO;
import com.financing.platform.util.SqlName;
import com.financing.platform.util.StringUtil;
/**
 * wx_user_info  
 * 用户表 数据访问层实现类
 * @author lisu
 *
 */
 
@Repository("wxUserInfoDao")
public class WxUserInfoDaoImpl extends BaseDaoImpl implements IWxUserInfoDao {


	@Override
	public int insert(WxUserInfoDTO wxUserInfo) throws SQLException {
//		setUserName(wxUserInfo);
		return (Integer) this.sqlMapClient.insert(SqlName.WxUserInfoSql.insert, wxUserInfo);
	}
//	//过滤昵称的  表情符号
//	public void setUserName(WxUserInfoDTO wxUserInfo) {
//		if(wxUserInfo!=null&&!StringUtil.isNullOrEmptyStr(wxUserInfo.getUserName())){
//			wxUserInfo.setUserName(EmojiFilter.filterEmoji(wxUserInfo.getUserName()));
//		}
//	}

	@Override
	public void update(WxUserInfoDTO wxUserInfo) throws SQLException {
//		setUserName(wxUserInfo);
		this.sqlMapClient.update(SqlName.WxUserInfoSql.update, wxUserInfo);
	}

	@Override
	public void updateForce(WxUserInfoDTO wxUserInfo) throws SQLException {
//		setUserName(wxUserInfo);
		this.sqlMapClient.update(SqlName.WxUserInfoSql.updateForce, wxUserInfo);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		this.sqlMapClient.delete(SqlName.WxUserInfoSql.delete,id);
	}
	
	@SuppressWarnings("unchecked")	
	@Override
	public List<WxUserInfoDTO> queryList(WxUserInfoDTO wxUserInfo) throws SQLException {
		return this.sqlMapClient.queryForList(SqlName.WxUserInfoSql.queryList, wxUserInfo);
	}

	@Override
	public int queryListCount(WxUserInfoDTO wxUserInfo) throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject(SqlName.WxUserInfoSql.queryListCount, wxUserInfo);
	}

	@Override
	public WxUserInfoDTO loadById(Integer id) throws SQLException {
		return  (WxUserInfoDTO)this.sqlMapClient.queryForObject(SqlName.WxUserInfoSql.loadById,id);
	}

	@Override
	public WxUserInfoDTO loadByUserPhone(WxUserInfoDTO wxUserInfo) throws SQLException {
		// TODO Auto-generated method stub
		return  (WxUserInfoDTO)this.sqlMapClient.queryForObject(SqlName.WxUserInfoSql.loadByUserPhone,wxUserInfo);
	}

	
 	
}
